package com.wzh.test.graphic;

import org.omg.CORBA.PUBLIC_MEMBER;

import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * 创建图，以二维数组的形式保存图的信息
 * 图 有顶点（vertex） 有边(edge)
 */
public class CreateGraphicDemo {
    public static void main(String[] args) {
        Graphic graphic = new Graphic(5);
        graphic.addVertex("A");
        graphic.addVertex("B");
        graphic.addVertex("C");
        graphic.addVertex("D");
        graphic.addVertex("E");

        graphic.addEdge("A", "B", 1);
        graphic.addEdge("A", "D", 1);
        graphic.addEdge("B", "C", 1);
        graphic.addEdge("B", "D", 1);
        graphic.addEdge("D", "E", 1);

        graphic.showGraphic();
        System.out.println("深度优先遍历");
        graphic.dfs();
        System.out.println("广度优先遍历");
        graphic.bfs();

    }
}


